from django.shortcuts import render
from django.http.response import HttpResponse
# from django.views.decorators.http import *
# Create your views here.
# @ require_http_methods(["POST"])
from django.db import connection
from django.template.loader import render_to_string
from django.http import QueryDict
def index(request):
    print(request.GET) # 从网页的请求中获取数据。
    print(request.GET.get("name",'')) # 从网页的请求中获取数据。
    print(request.POST)  # 从网页的请求中获取数据。
    # 从mysql数据库导入数据。
    cursor = connection.cursor()
    cursor.execute("select * from Employee")
    rows = cursor.fetchone()
    dic={}
    Employee_list = ('emplo_id', 'name', 'department', 'ID', 'phone', 'password', 'attribute', 'post', 'address', 'note')
    for x in range(len(Employee_list)):
        dic[Employee_list[x]]=rows[x]
    # html=render_to_string('0327.html')
    # print(dic)
    data=dic
    return render(request,template_name='0327.html',context={'data':data})
    # return HttpResponse(html)